<template>
	<div>
		<form @submit.prevent="doLogin">
			<div>
				用户名:
				<input type="text" v-model="user.username" />
			</div>
			<div>
				密码：
				<input type="text" v-model="user.password" />
			</div>
			<button>登录</button>
		</form>
	</div>
</template>

<script>
export default {
	data() {
		return {
			user: {},
		};
	},
	methods: {
		doLogin() {
			// 设置本地存储
			localStorage.setItem("user", this.user.username);
			this.$router.push("/admin");
		},
	},
};
</script>

<style lang="scss" scoped></style>
